package team.archai.nexus.flow.config;

import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.data.rest.RepositoryRestMvcAutoConfiguration;
import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import team.archai.nexus.flow.service.IProcessBasicsData;
import team.archai.nexus.flow.service.impl.DefaultProcessBasicsData;

/**
 * @author lishibin
 * @desc: 报表 设计器自动装配类
 * @date 2023-08-03
 */
@ComponentScan({"team.archai.nexus"})
@EnableConfigurationProperties(FlowDesignerProperties.class)
@ConditionalOnProperty(value = "archai-nexus.flow-designer.enabled", havingValue = "true")
@AutoConfigureAfter({WebMvcAutoConfiguration.class, JacksonAutoConfiguration.class,
        HttpMessageConvertersAutoConfiguration.class, RepositoryRestMvcAutoConfiguration.class})
public class FlowDesignerAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean(IProcessBasicsData.class)
    public IProcessBasicsData processBasicsData() {
        return new DefaultProcessBasicsData();
    }


}
